<template>
  <div class="index">
    <template>
      <app-header></app-header>
    </template>

    <template>
      <div class="index-body">
        <div class="index-carousel">
          <index-carousel :imgList='imgLis'></index-carousel>
        </div>
        <div class="index-list">
          <h2 class="mg-t30" @click="notifBtn">项目介绍</h2>
          <template>
            <index-project :projectList='projectLis'> </index-project>
          </template>
        </div>
      </div>
    </template>
    <template>
      <app-footer></app-footer>
    </template>
  </div>
</template>
<script>
import AppHeader from '@/components/layout/header/Header.vue'
import AppFooter from '@/components/layout/footer/Footer.vue'
import IndexCarousel from './components/Carousel'
import IndexProject from './components/Project'
export default {
  beforeRouteEnter (to, from, next) {
    console.log('beforeRouteEnter', this)
    next(vm => {
      console.log('after enter vm.id is ', vm)
    })
  },
  beforeRouteUpdate (to, from, next) {
    console.log('beforeRouteUpdate')
    next()
  },
  beforeRouteLeave (to, from, next) {
    console.log('beforeRouteLeave')
    next()
  },
  computed: {
    nameLink: function () {
      return this.serverSrc()
    }
  },
  mounted () {
    console.log('this=', this.$notif)
    // console.log('this  y=', this.$notify)
  },
  name: 'Index',
  components: {
    AppHeader,
    AppFooter,
    IndexCarousel,
    IndexProject
  },
  data () {
    return {
      imgLis: [
        {
          id: 1,
          url: require('../../assets/image/bg/a.jpg')
        },
        {
          id: 2,
          url: require('../../assets/image/bg/b.jpg')
        },
        {
          id: 3,
          url: require('../../assets/image/bg/c.jpg')
        }
      ],
      projectLis: [
        {
          id: 1,
          title: 'AAAA',
          url: require('../../assets/image/index/a.jpg')
        },
        {
          id: 2,
          title: 'BBBB',
          url: require('../../assets/image/index/b.jpg')
        },
        {
          id: 3,
          title: 'CCCC',
          url: require('../../assets/image/index/c.jpg')
        }
      ]
    }
  },
  methods: {
    notifBtn () {
      this.$notif({
        notification: 'test notify',
        btn: 'colse'
      })
    }
  }
}
</script>

<style scoped lang="scss">
.index {
  width: 100%;
  height: 100%;
  min-height: 100vh;
}
.index-body {
  width: 100%;
  min-height: calc(100vh - 120px);
}
.index-carousel {
  width: 1200px;
  height: 300px;
  margin: 0 auto;
  // border: 1px solid red;
}
.index-list {
  width: 100%;
  height: auto;
}
</style>
